MAXN = 20

p = [list([False] * MAXN)] * MAXN
det = [list([None] * MAXN)] * MAXN
n = 0

def dfs(x):
    if x + 1 == n:
        a = 0
        b = 0
        c = 0
        d = 0
        for i in range(1, n + 1):
            if b == True:
                break
            if p[i] == True:
                continue
            if a == True:
                a = det[x][i]
                c = det[x + 1][i]
            else :
                b = det[x][i]
                d = det[x + 1][i]
        print(a * d - c * b)
        return a * d - c * b
    sum = 0
    tmp = 0
    now = True
    for i in range(1, n + 1):
        if p[i] == True:
            continue
        else :
            p[i] = True
            tmp = dfs(x + 1)
            if now == True :
                sum += det[x][i] * tmp
            else :
                sum += -1 * det[x][i] * tmp
            if now == True:
                now = False
            else :
                now = True
            p[i] = False
    return sum

if __name__ == '__main__':
    n = int(input())
    for i in range(1, n + 1):
        l = input().split(' ')
        for j in range(1, n + 1):
            det[i][j] = int(l[j - 1])
    print(dfs(1))